package bitOperation;

import org.junit.Test;

/*
 *@description 颠倒二进制位
 *@author hkfan
 *@version 1.0
 *@create 2025/6/23 16:50
 */
public class LeetCode_190 {
    // you need treat n as an unsigned value
    @Test
    public void test(){
        System.out.println(reverseBits(964176192 ));
    }
    public int reverseBits(int n) {
        int res=0;
        for (int i = 0; i < 32; i++) {
            res=res*2+(n&1);
            n=n>>1;
        }
        return res;
    }

}
